GLOBAL FOOTBALL TEAM IDENTITY REGISTRY — PHASE 1 INTEGRATION
============================================================

Purpose
-------
This is a local, independent verified-alias database connected to the existing
SoccerRating fixture verification and the optional existing recovery adapters.
It is NOT a ninth fixture source, and a name lookup is NOT an independent vote.
Existing user matches, Excel workbooks, queue, verified decisions, logos,
strategy data, browser login state and recovery limits are preserved.

WHAT IS IN THIS PACKAGE
-----------------------
- team_identity_registry.py: SQLite schema, safe identity resolver, importers.
- team_identity_registry.db: prebuilt local observations from the uploaded
  match and SoccerRating queue data. These are raw names, not automatically
  approved equivalences.
- TEAM_IDENTITY_BUILD.py: offline source-ingestion command-line tool.
- /api/team-identity/status: authenticated, read-only registry statistics.
- SoccerRating verification adapters now consult the local database for
  verified aliases, with existing fixture/date/country/league safeguards.
- The free recovery adapters (OpenLigaDB, OpenFootball, official event pages)
  use the same central resolver. Tavily's already-allowed second search can
  use a known verified alias. No additional network calls are introduced.

IMPORT FREE SOURCES (after obtaining source data yourself)
----------------------------------------------------------
Open a terminal in the 'FOOTBALL MAIN APP' folder. Use Python 3:

  python TEAM_IDENTITY_BUILD.py --stats
  python TEAM_IDENTITY_BUILD.py --find "Arsenal FC" --country England
  python TEAM_IDENTITY_BUILD.py --seed-local --stats

Download and extract the official CC0 OpenFootball Clubs repository from
https://github.com/openfootball/clubs (Code > Download ZIP).

  python TEAM_IDENTITY_BUILD.py --openfootball "C:\path\to\clubs-master" --stats

Download the CURRENT Reep v1 CSV release at https://reep.football/data/
(release ZIP CSV tables; v0 data from github.com/withqwerty/reep is NOT
compatible). If available, extract entities.csv(.gz), bridges.csv(.gz),
provider_aliases.csv(.gz), overlay_aliases.csv(.gz), redirects.csv(.gz).

  python TEAM_IDENTITY_BUILD.py --reep "C:\path\to\reep-csv-bundle" --stats

Generic CSV import for any of the ten catalogued free data sources:
  external_id,name,country,category,gender,aliases,provider,namespace
  123,Manchester United,England,,,Man Utd|Man United,api_football,

  python TEAM_IDENTITY_BUILD.py --csv "C:\path\to\reviewed.csv" --source "API-Football"

Generic source CSV imports are PROPOSED by default and therefore cannot cast
verification identity votes. Use --verified-reviewed ONLY after an independent
identity audit has approved each claim, or do not provide this flag. Downloaded
provider name lists cannot safely be merged by name alone.

INITIAL LIMITS — IMPORTANT
--------------------------
- Runtime cannot access external data downloads from this packaging session;
  no Reep/OpenFootball/Wikidata/etc bulk datasets have been downloaded into
  this initial ZIP. Ten free sources are catalogued; connectors for Reep CSV,
  OpenFootball TXT and normalized CSV are implemented. Eight other source
  schemas still require a normalized export (no live background API calls).
- Initial historical SoccerRating/match names are observations only, which
  means they do not yet expand approved alias matching until verified external
  datasets are imported.
- Country, gender, reserve/youth categories and home/away orientation remain
  strict. Ambiguous aliases are not accepted. An independent verified name
  can still be rejected if its country is inconsistent or a league conflicts.
- Downloads and API access must comply with the source's own terms and rate
  limits. Free access is not the same as permission to redistribute.
- Refresh the external registry manually after downloading newer snapshots.
  A separate source revision audit is recommended before automation.
- The Reep CSV importer supports the current v1 fields documented by Reep,
  but needs validation against an actual full release before production use.

SAFETY & ROLLBACK
-----------------
Your original ZIP is unchanged. For rollback, stop the app and restore it.
The only new persistent file is team_identity_registry.db; no primary SQLite
match or queue table is migrated. Remove this file to reset the registry.
No existing matches or queue decisions are rewritten. Anonymous unreviewed
name observations cannot match teams automatically.
